# -*- coding: utf-8 -*-
# https://blog.csdn.net/weixin_52040868
# 公众号：测个der
# 微信：qing_an_an

import sys
from PyQt5.QtWidgets import *
import qdarkstyle


class MainWindow(QWidget):
    def __init__(self):
        super(MainWindow, self).__init__()
        btn = QPushButton("点击",self)
        # 如果引用样式，则可以采取如下操作
        # btn.setStyleSheet("background-color:yellow")
        btn1 = QPushButton("获取",self)
        btn1.move(50,50)
        btn1.setObjectName('btn1')

    @staticmethod
    def read_qss_file(qss_file_name):
        with open(qss_file_name, 'r', encoding='UTF-8') as file:
            return file.read()

if __name__ == '__main__':
    app = QApplication(sys.argv)
    win = MainWindow()
    style_file = './style.qss'
    style_sheet = win.read_qss_file(style_file)
    # win.setStyleSheet(qdarkstyle.load_stylesheet())
    app.setStyleSheet(qdarkstyle.load_stylesheet(qt_api='pyqt5'))
    win.show()
    sys.exit(app.exec_())
